/* 
 * File:   JAdapterThread.h
 * Author: johnneyshi
 *
 * Created on 2013年3月4日, 上午9:43
 */

#ifndef JAdapterThread_H
#define	JAdapterThread_H
#include "JServerMaster.h"

#include "JDefine.h"
#include "JEpoll.h"
#include "JClient.h"
/*
 * 连接master和worker之间
 */


struct AdapterThreadArg;

class JAdapterThread {
public:
    JAdapterThread(AdapterThreadArg* _pArg);
    void Start();
    virtual ~JAdapterThread();
private:
    void GetToMasterConnFd();
    int toMasterConnFd;
    int toWorkerConnFd;
    void ConnectToWorker();
    /*传输toMasterConnFd到toWorkerConnFd之间的数据,
     * 当它返回时，表示处理结束，或者是toMasterConnFd断开，或者toWorkerConnFd断开.
     */
    int TransmitMsg();
    AdapterThreadArg* pArg;
    JClient client;
    JEpoll epoll;
};

#endif	/* JAdapterThread_H */

